from django.shortcuts import render
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.viewsets import ViewSet

from P3_02 import models, Ser


# Create your views here.
class NavView(APIView):
    def get(self,request):
        navlist = models.Nav.objects.filter(is_delete=False,is_show=True).order_by("sort")
        ser = Ser.NavSer(navlist,many=True)
        return Response({"code":200,"msg":"获取成功", "data": ser.data})